package cate.common.table.item.equip.sheet;

import cate.common.table.ESheet;
import cate.common.table.item.equip.row.EquipBaseRow;

import java.util.ArrayList;
import java.util.List;

/** 装备 */
public class EquipBaseSheet extends ESheet<EquipBaseRow> {

    @Override
    public String getSheetName() {
        return "装备基础";
    }



    //理论上只会找到一个
    public EquipBaseRow findOne(byte job, byte pos, byte quality) {
        for (EquipBaseRow row : this.getList()) {
            if (row.job == job && row.pos == pos && row.quality == quality) {
                return row;
            }
        }
        return null;
    }

    public List<EquipBaseRow> find(byte job,byte quality){
        List<EquipBaseRow> result = new ArrayList<>();
        for (EquipBaseRow row : this.getList()) {
            if (row.job == job && row.quality == quality) {
                result.add(row);
            }
        }
        return result;
    }

    public EquipBaseRow getPreOverstepEquipRow(int overstepId) {
        return getList().stream().filter(e -> e.overstepId == overstepId).findAny().orElse(null);
    }
}
